<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #formlogin{
            width: 220px;
            margin: 0 auto;
            border: 1px solid gray;
            padding: 10px 20px;
        }
        #formlogin>div{
            margin: 15px 0;
        }
    </style>
</head>
<body>
    <form id="formlogin">
        <div>账号：<input name="username"></div>
        <div>密码：<input type="password" name="password"></div>
        <div>
            <button type="submit">提交</button>
            <button type="reset">清空</button>
        </div>
    </form>
    <script>
        formlogin.onsubmit=function(event){
            if(formlogin.username==='admin'&&formlogin.password==='1234'){
                alert("登录成功");
            }else{
                alert("登录失败");
            }
        }
    </script>
</body>
</html>